{php $pk = dr_string2array($pk_shuxing);}
{php $pkbiaoku = '1_'.MOD_DIR.'_form_son_pk';}
<div class="d-shang-15">
	<div class="d-kuan">
		<div>

			<div class="row">
				<div class="col-md-12 d-buhuanhang">
					<div class="baifen-50-500 liebiaotu-zuo-500 xia-10 a">
						<img src="{dr_thumb($lanfang)}" class="img-fluid yinying d-kuan">
					</div>
					<div class="kuan-5"></div>
					<div class="baifen-50-500 liebiaotu-you-500 xia-10 a">
						<img src="{dr_thumb($hongfang)}" class="img-fluid yinying d-kuan">
					</div>
				</div>
			</div>
			<!---->
			<div class="row ">
				<div class="col-md-12 d-buhuanhang">
					<div class="d-wenzi-14 d-yuanjiao-zuo-10-10 baifen-50-500 liebiaotu-zuo-500 xia-10 a d-neikuang-10 d-huanhang" style="background-color: #eaf4f4;color: #135e87;">
						蓝方：{$lfsm}
					</div>
					<div class="kuan-5"></div>
					<div class="d-wenzi-12 d-yuanjiao-you-10-10 baifen-50-500 liebiaotu-you-500 xia-10 a d-neikuang-10 d-huanhang" style="background-color: #f8e7e7;color: #8d281f;">
						红方：{$hfsm}
					</div>
				</div>
				
			</div>
			
			{php $yipk = \Phpcmf\Service::M()->db->table('1_'.MOD_DIR.'_form_son_pk')->where('cid', $id)->where('uid', $member.id)->get()->getRowArray();}
			{if $yipk}
			<div class="row d-xia-10">
				<div class="col-md-12 d-buhuanhang d-quxian-0">
					<a onclick="javascript:d_yipk();" class="d-yuanjiao-zuo-20-20" style="width:{if $pk['lanfangbili']}{$pk['lanfangbili']}{else}50{/if}%;height: 30px;background-color: #91bed5;color: #ffffff;">
					<div >
						<span class="d-zuo-10 d-hanggao-30">{if $pk['lanfangtongji']}{$pk['lanfangtongji']}{else}0{/if}</span>
						<span class="d-hanggao-30 d-wenzi-12">位</span>
						{if $yipk['pkfang'] == 1}
						    <img src="{dr_avatar($yipk['uid'])}" class="d-yuanjiao-50 d-shang-4" width="22" height="22" style="background-color: #ffffff;"/>
						{/if}
					</div>
					</a>
					<div class="d-wenzi-juzhong" style="width:31px;height: 30px;background-color: #ffffff;color: #ffffff;background-image:url('{HOME_THEME_PATH}web/img/pk.png');">
						<!--img src="{HOME_THEME_PATH}web/img/pk.png"-->
					</div>
					<a onclick="javascript:d_yipk();" class="d-yuanjiao-you-20-20 d-wenzi-you" style="width:{if $pk['hongfangbili']}{$pk['hongfangbili']}{else}50{/if}%;height: 30px;background-color: #f1785a;color: #ffffff;">
					<div>
						
						{if $yipk['pkfang'] == 2}
						    <img src="{dr_avatar($yipk['uid'])}" class="d-yuanjiao-50 d-shang-4 d-you-5" width="22" height="22" style="background-color: #ffffff;"/>
						{/if}
						<span class="d-hanggao-30 ">{if $pk['hongfangtongji']}{$pk['hongfangtongji']}{else}0{/if}</span>
						<span class="d-hanggao-30 d-wenzi-12 d-you-10">位</span>
						
					</div>
					</a>
				</div>
			</div>
			
			{else}
				{if $member}
					{if $pkpingyu == 0}
						<div class="row d-xia-10">
							<div class="col-md-12 d-buhuanhang d-quxian-0">
								<a id="tag_lan_{$id}" data-id="{$id}" class="tag_lan d-yuanjiao-zuo-20-20" style="width:{if $pk['lanfangbili']}{$pk['lanfangbili']}{else}50{/if}%;height: 30px;background-color: #91bed5;color: #ffffff;">
								<div>
									<span class="d-zuo-10 d-hanggao-30">{if $pk['lanfangtongji']}{$pk['lanfangtongji']}{else}0{/if}</span>
									<span class="d-hanggao-30 d-wenzi-12">位</span>
								</div>
								</a>
								<div class="d-wenzi-juzhong" style="width:31px;height: 30px;background-color: #ffffff;color: #ffffff;background-image:url('{HOME_THEME_PATH}web/img/pk.png');">
									<!--img src="{HOME_THEME_PATH}web/img/pk.png"-->
								</div>
								<a id="tag_hong_{$id}" data-id="{$id}" class="tag_hong d-yuanjiao-you-20-20 d-wenzi-you" style="width:{if $pk['hongfangbili']}{$pk['hongfangbili']}{else}50{/if}%;height: 30px;background-color: #f1785a;color: #ffffff;">
								<div>
									
									
									<span class="d-hanggao-30 ">{if $pk['hongfangtongji']}{$pk['hongfangtongji']}{else}0{/if}</span>
									<span class="d-hanggao-30 d-wenzi-12 d-you-10">位</span>
								</div>
								</a>
							</div>
						</div>
					{else}
					<!--必须写评语-->
						<div class="row d-xia-10">
							<div class="col-md-12 d-buhuanhang d-quxian-0">
								<a id="tag_lan_{$id}" data-id="{$id}" onclick="javascript:d_pk_baoming_pingyu();" class="d-yuanjiao-zuo-20-20" style="width:{if $pk['lanfangbili']}{$pk['lanfangbili']}{else}50{/if}%;height: 30px;background-color: #91bed5;color: #ffffff;">
								<div>
									<span class="d-zuo-10 d-hanggao-30">{if $pk['lanfangtongji']}{$pk['lanfangtongji']}{else}0{/if}</span>
									<span class="d-hanggao-30 d-wenzi-12">位</span>
								</div>
								</a>
								<div class="d-wenzi-juzhong" style="width:31px;height: 30px;background-color: #ffffff;color: #ffffff;background-image:url('{HOME_THEME_PATH}web/img/pk.png');">
									<!--img src="{HOME_THEME_PATH}web/img/pk.png"-->
								</div>
								<a id="tag_hong_{$id}" data-id="{$id}" onclick="javascript:d_pk_baoming_pingyu();" class="d-yuanjiao-you-20-20 d-wenzi-you" style="width:{if $pk['hongfangbili']}{$pk['hongfangbili']}{else}50{/if}%;height: 30px;background-color: #f1785a;color: #ffffff;">
								<div>
									
									
									<span class="d-hanggao-30 ">{if $pk['hongfangtongji']}{$pk['hongfangtongji']}{else}0{/if}</span>
									<span class="d-hanggao-30 d-wenzi-12 d-you-10">位</span>
								</div>
								</a>
							</div>
						</div>
					{/if}
				{else}
					<div class="row d-xia-10">
						<div class="col-md-12 d-buhuanhang d-quxian-0">
							<a href="{dr_member_url("login/index", ["back" => urlencode($my_web_url)])}" class="d-yuanjiao-zuo-20-20" style="width:{if $pk['lanfangbili']}{$pk['lanfangbili']}{else}50{/if}%;height: 30px;background-color: #91bed5;color: #ffffff;">
							<div>
								<span class="d-zuo-10 d-hanggao-30">{if $pk['lanfangtongji']}{$pk['lanfangtongji']}{else}0{/if}</span>
								<span class="d-hanggao-30 d-wenzi-12">位</span>
							</div>
							</a>
							<div class="d-wenzi-juzhong" style="width:31px;height: 30px;background-color: #ffffff;color: #ffffff;background-image:url('{HOME_THEME_PATH}web/img/pk.png');">
								<!--img src="{HOME_THEME_PATH}web/img/pk.png"-->
							</div>
							<a href="{dr_member_url("login/index", ["back" => urlencode($my_web_url)])}" class="d-yuanjiao-you-20-20 d-wenzi-you" style="width:{if $pk['hongfangbili']}{$pk['hongfangbili']}{else}50{/if}%;height: 30px;background-color: #f1785a;color: #ffffff;">
							<div>
								<span class="d-hanggao-30 ">{if $pk['hongfangtongji']}{$pk['hongfangtongji']}{else}0{/if}</span>
								<span class="d-hanggao-30 d-wenzi-12 d-you-10">位</span>
							</div>
							</a>
						</div>
					</div>
				{/if}
			{/if}
			<!---->
			
			<div class="row ">
				<div class="col-md-12 d-buhuanhang">
					<div class="d-wenzi-12 d-baifen-50 xia-10 a  d-huanhang">
						<div class="d-yuanjiao-20 d-kuan d-buhuanhang d-shang-10 d-a-hei">
							{table table=$pkbiaoku baominghedui=1 cid=$id pkfang=1 pkshenhe=0 order=inputtime_desc num=15 return=t}
								<a href="/index.php?s=huiyuan&c=show&m=index&uid={$t.uid}" class="d-touxiang-30-0">
									<img src="{dr_avatar($t.uid)}" class="d-yuanjiao-50"/>
								</a>
							{/table}
						</div>
						
					</div>
					<div class="kuan-5"></div>
					<div class="d-wenzi-12  d-baifen-50 xia-10 a  d-huanhang" >
						<div class="d-yuanjiao-20 d-kuan d-buhuanhang d-shang-10 d-a-hei">
							{table table=$pkbiaoku baominghedui=1 cid=$id pkfang=2 pkshenhe=0 order=inputtime_desc num=15 return=t}
								<a href="/index.php?s=huiyuan&c=show&m=index&uid={$t.uid}" class="d-touxiang-30-0">
									<img src="{dr_avatar($t.uid)}" class="d-yuanjiao-50"/>
								</a>
							{/table}
						</div>
					</div>
				</div>
			</div>
			<div class="row d-xia-10 d-wenzi-juzhong d-wenzi-14 d-zitiyanse-hui">
				{if $yipk['pkshenhe']==0}
				    {if $yipk['pkfang']==1 || $yipk['pkfang']==2}
						您已经支持
						{if $yipk['pkfang']==1}<span class="d-zitiyanse-lan">蓝方</span>
						{elseif $yipk['pkfang']==2}
						<span class="d-zitiyanse-hongse">红方</span>
						{/if} 
						{if $yipk['jiangli'] > 0} 奖励<span class="d-zitiyanse-hongse"> {$yipk['jiangli']} </span> {SITE_SCORE} {/if}
						{if $yipk['jianglirmb'] > 0} 奖励<span class="d-zitiyanse-hongse"> {$yipk['jianglirmb']} </span> 金币{/if}
					{/if} 
				{elseif $yipk['pkshenhe']==1}
				您已经支持{if $yipk['pkfang']==1}<span class="d-zitiyanse-lan">蓝方</span>{elseif $yipk['pkfang']==2}<span class="d-zitiyanse-hongse">红方</span>{/if} 
				正在审核中...
				{else}
				感谢您的支持，PK没有通过，期待参与下回PK
				{/if}
			</div>
			{php $xiaofeiesum = \Phpcmf\Service::M()->db->table('1_'.MOD_DIR.'_form_son_pk')->where('cid', $id)->selectSum('jianglirmb')->get()->getRowArray();}
			{php $xiaofeiejifensum = \Phpcmf\Service::M()->db->table('1_'.MOD_DIR.'_form_son_pk')->where('cid', $id)->selectSum('jiangli')->get()->getRowArray();}
			{php $pkrmbzhi = $xiaofeie - $xiaofeiesum['jianglirmb'];}
			{php $pkjifenzhi = $xiaofeie - $xiaofeiejifensum['jiangli'];}
			<div class="row d-xia-10 d-wenzi-juzhong d-wenzi-14 d-zitiyanse-hui">
				{if $pkjiangli ==1}
				    {if $xiaofeiejifensum['jiangli'] < $pkjifenzhi}
					总奖励：{$xiaofeie}{SITE_SCORE}，每人 {$jianglijifen} {SITE_SCORE}，还剩余 {$pkjifenzhi} {SITE_SCORE}
					{else}
					{$xiaofeie}{SITE_SCORE} 已经领完了
					{/if}
				{elseif $pkjiangli ==2}
					{if $xiaofeiejifensum['jiangli'] < $pkrmbzhi}
					总奖励：{$xiaofeie}金币，每人 {{$jlrmb} 金币，还剩余 {$pkrmbzhi} 金币
					{else}
					{$xiaofeie}金币 已经领完了
					{/if}
				{/if}
			</div>
			{if $index['uid'] == $member.id}
			{php $xinshenhe = \Phpcmf\Service::M()->db->table('1_'.MOD_DIR.'_form_son_pk')->where('cid', $id)->where('pkshenhe', 1)->countAllResults();}
				{if $xinshenhe}
					<div class="row d-xia-10 d-wenzi-juzhong d-wenzi-14 d-zitiyanse-hui d-quxian-0" >
						<a onclick="javascript:d_pk_baoming_yonghu();">
							<span class="d-zuo-10 d-hanggao-30"><i class="fa fa-comments"></i> 有 <span class="d-zitiyanse-hongse">{$xinshenhe}</span> 位新的PK需要审核</span>
						</a>
						
					</div>
				{/if}
			{/if}
			
		</div>
	</div>
</div>
<!--审核用户-->
<div class="d-xiala-pk-yonghu" style="display: none;">
	<div class="d-container">
		<div class="d-row">
			<div class="d-col-md-8-juzhong d-quxian-0 d-a-baise d-neikuang-10">
				<div class="d-neikuang-15 ">
					<div class="d-kuan d-neikuang-10" onclick="javascript:d_pk_baoming_yonghu();"><i class="bi bi-x-circle-fill"></i></div>
				</div>
				{table table=$pkbiaoku pkshenhe=1 cid=$id order=inputtime_desc num=1000 return=t}
				
				{php $user=dr_member_info($t.uid);} 
				
				<div id="d-pkyjtongguo_{$t.id}">
					<div id="d-pkshanchu_{$t.id}" class=" d-wenzi-14 d-yuanjiao-10  xia-10 a d-neikuang-10 d-huanhang" {if $t.pkfang == 1}style="background-color: #eaf4f4;color: #135e87;"{else}style="background-color: #f8e7e7;color: #8d281f;"{/if}>
						<div class="d-kuan d-buhuanhang d-wenzi-12">
							
							<div class="d-img-20">
								<a href="/index.php?s=huiyuan&c=show&m=index&uid={$t.uid}" class="d-touxiang-20-0 d-img-20">
									<img src="{dr_avatar($t.uid)}" class=" d-yuanjiao-50" width="16" height="16"/>
								</a>
							</div>
							<div class="d-zuo-10">
								报名号：{$t.id}
							</div>
							<div class="d-zuo-10">
								{$user.username}
							</div>
							{if $pkjiangli == 1}
							<div class="d-zuo-10">
								 奖励{SITE_SCORE}：<i class="bi bi-gem"></i> {$jianglijifen}
							</div>
							{elseif $pkjiangli == 2}
							<div class="d-zuo-10">
								 奖励金币： <i class="fa fa-jpy"></i> {$jlrmb}
							</div>
							{/if}
							
							
						
						</div>
						<div class="d-kuan d-buhuanhang d-wenzi-12">
							<a class="d-zuo-10 pull-right tag_pkshanchu" data-id="{$t.id}">
								<i class="fa fa-remove"></i> 删除
							</a>
							<a class="d-zuo-10 pull-right tag_pkbutong" id="tag_butong_{$t.id}" data-id="{$t.id}">
								<i class="fa fa-remove"></i> 不符合
							</a>
							<a class="d-zuo-10 pull-right tag_pktongguo" id="tag_pktongguo_{$t.id}" data-id="{$t.id}" data-uid="{$t.uid}">
								<i class="fa fa-check"></i> 通过
							</a>
						</div>
						
						{if $t.pkfang == 1}
						<div class="d-chaochu d-shang-10"><i class="fa fa-comments-o"></i> 
						<div id="d-pkbutong_{$t.id}"></div> <div id="d-pktongguo_{$t.id}"></div> 蓝方： 
							{php $pingyu1 = \Phpcmf\Service::M()->db->table('1_'.MOD_DIR.'_form_son_comment')->where('cid', $id)->where('uid', $t.uid)->where('inputtime', $t.inputtime)->get()->getRowArray();}
								{if $pingyu1['content']}{$pingyu1['content']}{else}<span style="color: #8d281f;">--没有评语--</span>{/if}
						</div>
						{else}
						<div class="d-chaochu d-shang-10"><i class="fa fa-comments"></i>  
						<div id="d-pkbutong_{$t.id}"></div> <div id="d-pktongguo_{$t.id}"></div> 红方：
						{php $pingyu2 = \Phpcmf\Service::M()->db->table('1_'.MOD_DIR.'_form_son_comment')->where('cid', $id)->where('uid', $t.uid)->where('inputtime', $t.inputtime)->get()->getRowArray();}
							{if $pingyu2['content']}{$pingyu2['content']}{else}<span style="color: #8d281f;">--没有评语--</span>{/if}
						</div>
						{/if}
					</div>
				</div>
				{/table}
				
			</div>
		</div>
	</div>
</div>
<!--必须写评语弹出框-->
<div class="d-xiala-pk-pingyu" style="display: none;">
	<div class="d-container">
		<div class="d-row">
			<div class="d-col-md-8-juzhong d-quxian-0 d-a-baise d-neikuang-10">
				<div class="d-col-md-8">
					<div class="d-kuan d-neikuang-10 d-wenzi-juzhong" onclick="javascript:d_pk_baoming_pingyu();"><i class="bi bi-x-circle-fill"></i></div>
				</div>
				{dr_mform_comment_3(MOD_DIR,'son', $id, $index.fengge)}
				
			</div>
		</div>
	</div>
</div>
<style>
	.d-xiala-pk-yonghu {
	    z-index: 999999;
	    position: fixed;
	    bottom: 0px;
	    width: 100%;
	    height: 70%;
	    overflow: auto;
	    background: #ffffff;
	    right: 0;
	    left: 0;
	    box-shadow: 0 0 20px #d6d6d6;
	    background-color: rgba(255, 255, 255, 1.0);
	}
	.d-xiala-pk-pingyu {
	    z-index: 999999;
	    position: fixed;
	    bottom: 0px;
	    width: 100%;
	    height: 50%;
	    overflow: auto;
	    background: #ffffff;
	    right: 0;
	    left: 0;
	    box-shadow: 0 0 20px #d6d6d6;
	    background-color: rgba(255, 255, 255, 1.0);
	}
	.d-baifen-50 {
		width: 50%;
	}
	.d-touxiang-30-0 {
	    margin-right: -10px;
	    /*background-color: #ffffff;*/
	    border-radius: 50px;
	    /*box-shadow: 0 -3px 6px rgb(0 0 0 / 100%);*/
		
	    
	}
	.d-touxiang-30-0 img{
	    max-width: 100%;
	    margin-bottom: 0px;
	    background-color: #ffffff;
		border: 2px solid #ffffff;
		width: 25px;
	}
</style>

<script>
	$(".tag_lan").click(function(){
		 var id = $(this).data("id");
		 var quanid = $(this).data("quanid");
		 var pkfang = $(this).data("pkfang");
		 $.get("{dr_url_prefix('index.php')}?s={MOD_DIR}&c=son&m=pk&id="+id+"&quanid=0&pkfang=1", function(data){
			 dr_cmf_tips(data.code, data.msg.value + data.msg.jifen);
			 if (data.msg.value=="支持成功") {
				window.location.reload();
			}else{
				window.location.reload();
			}
		 }, 'json');
	});
	$(".tag_hong").click(function(){
		 var id = $(this).data("id");
		 var quanid = $(this).data("quanid");
		 var pkfang = $(this).data("pkfang");
		 $.get("{dr_url_prefix('index.php')}?s={MOD_DIR}&c=son&m=pk&id="+id+"&quanid=0&pkfang=2", function(data){
			 dr_cmf_tips(data.code, data.msg.value + data.msg.jifen);
			 if (data.msg.value=="支持成功") {
				window.location.reload();
			}else{
				window.location.reload();
			}
		 }, 'json');
	});
	$(".tag_pkbutong").click(function(){
		 var id = $(this).data("id");
		 var quanid = $(this).data("quanid");
		 var pkfang = $(this).data("pkfang");
		 $.get("{dr_url_prefix('index.php')}?s={MOD_DIR}&c=son&m=pkbutong&id="+id+"&tieid={$id}&pkfang=3", function(data){
			 dr_cmf_tips(data.code, data.msg.value + data.msg.jifen);
			 if (data.msg.value=="操作成功，PK不通过") {
				//window.location.reload();
				$('#d-pkbutong_'+id).html('不通过');
			}else{
				//window.location.reload();
			}
		 }, 'json');
	});
	$(".tag_pkshanchu").click(function(){
		 var id = $(this).data("id");
		 var quanid = $(this).data("quanid");
		 var pkfang = $(this).data("pkfang");
		 $.get("{dr_url_prefix('index.php')}?s={MOD_DIR}&c=son&m=pkshanchu&id="+id+"&tieid={$id}&pkfang=3", function(data){
			 dr_cmf_tips(data.code, data.msg.value + data.msg.jifen);
			 if (data.msg.value=="已经删除成功") {
				//window.location.reload();
				$('#d-pkshanchu_'+id).hide();
			}else{
				//window.location.reload();
			}
		 }, 'json');
	});
	$(".tag_pktongguo").click(function(){
		 var id = $(this).data("id");
		 var uid = $(this).data("uid");
		 var pkfang = $(this).data("pkfang");
		 $.get("{dr_url_prefix('index.php')}?s={MOD_DIR}&c=son&m=pktongguo&id="+id+"&tieid={$id}&uid="+uid, function(data){
			 dr_cmf_tips(data.code, data.msg.value + data.msg.jifen);
			 if (data.msg.value=="操作成功已经通过") {
				//window.location.reload();
				$('#d-pktongguo_'+id).html('已通过');
				$('#d-pkyjtongguo_'+id).hide();
			}else{
				//window.location.reload();
			}
		 }, 'json');
	});
	
	/*$('.lanyc2').hide();
    $('.lanyc3').hide();
	$('.hongyc2').hide();
	$('.hongyc3').hide();*/
	//报名用户
	function d_pk_baoming_yonghu() {
		if ($('.d-xiala-pk-yonghu').is(':hidden')) {
			$('.d-xiala-pk-yonghu').show();
		} else {
			$('.d-xiala-pk-yonghu').hide();
		}
	}
	//pk评语
	function d_pk_baoming_pingyu() {
		if ($('.d-xiala-pk-pingyu').is(':hidden')) {
			$('.d-xiala-pk-pingyu').show();
		} else {
			$('.d-xiala-pk-pingyu').hide();
		}
	}
	function d_yipk() {
		layer.msg("您已参与PK",{time:1000});
	}
</script>